package com.plane;

import javax.imageio.ImageIO;
import java.awt.*;
import java.io.IOException;

public class Boss extends Sprite {
    private int index = 0;
    private int[] xStep = {
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            -10, -10, -10, -10, -10, -10, -10,
            10, 10, 10, 10, 10, 10, 10,
            10, 10, 10, 10, 10, 10, 10,
            -10, -10, -10, -10, -10, -10, -10,
            0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0
    };
    private int[] yStep = {
            20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
            0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0,
            40, 40, 40, 40,
            -10, -10, -10, -10, -10, -10, 10, -10,
            -10, -10, -10, -10, -10, -10, 10, -10
    };

    public Boss() {
        try {
            image = ImageIO.read(Boss.class.getResourceAsStream("boss_0.png"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        this.width = 170;
        this.height = 185;
        this.hp = 200;
        this.x = (Map.MAP_WIDTH - width) / 2;
        this.y = -height;
    }

    public void move() {
        this.x += xStep[index];
        this.y += yStep[index];
        index++;
        if (index >= xStep.length) {
            index = 10;
        }
    }

    public void paint(Graphics gTmp, GamePanel gp) {
        gTmp.drawImage(image, x, y, gp);
    }
}
